#ifndef CXON2_ENCODE_H
#define CXON2_ENCODE_H

typedef enum
    {
        CXON2_ENC_TYPE_H264 = 1,
		CXON2_ENC_TYPE_JPG,
		CXON2_ENC_TYPE_MPEG4,
    } CxOn2EncodeType;


typedef enum
    {
        CXON2_ENC_YUV420_PLANAR = 0,              /* YYYY... UUUU... VVVV */
        CXON2_ENC_YUV420_SEMIPLANAR = 1,          /* YYYY... UVUVUV...    */
        CXON2_ENC_YUV422_INTERLEAVED_YUYV = 2,    /* YUYVYUYV...          */
        CXON2_ENC_YUV422_INTERLEAVED_UYVY = 3,    /* UYVYUYVY...          */
		CXON2_ENC_RGB565 = 4,                     /* 16-bit RGB           */
        CXON2_ENC_BGR565 = 5,                     /* 16-bit RGB           */
        CXON2_ENC_RGB555 = 6,                     /* 15-bit RGB           */
        CXON2_ENC_BGR555 = 7,                     /* 15-bit RGB           */
    } CxOn2YuvFmt;


typedef void cxon2_write_stream_callback(void * user_ptr , const void * strmbuf, 
									  unsigned int size , unsigned int keyframe);



#ifdef __cplusplus
extern "C"
{
#endif

void cxon2_encode_write_stream(cxon2_write_stream_callback * write_cb , void * user_ptr , unsigned int * outbuf, unsigned int size, 
						  unsigned int endian , unsigned int keyframe);

void * cxon2_encode_init(CxOn2EncodeType encode_type , cxon2_write_stream_callback * write_cb , 
					  void * user_ptr , 
					unsigned int width , unsigned int height , unsigned int enc_width , unsigned int enc_height , 
						 CxOn2YuvFmt fmt , int bitrate , int gop , int fps_num , int fps_denorm , int jpgq);
void cxon2_encode_release(void * handle);
void cxon2_encode_start(void * handle);
void cxon2_encode_stop(void * handle);
void cxon2_encode_image(void * handle , unsigned int bus_addr);
void * cxon2_encode_get_output_data(void * handle , unsigned int * p_addr , unsigned int * p_size , 
							   unsigned * p_key_frame);
void cxon2_encode_set_rc(void * handle , int bitrate , int gop);
void cxon2_encode_set_fps(void * handle , int fps);
void cxon2_encode_set_jpg_q(void * handle , int q);
void cxon2_encode_force_I_frame(void * handle);
void * cxon2_encode_get_stream_head(void * handle , unsigned int * head_len);
void cxon2_encode_output_stream_head(void * handle);
void * cxon2_encode_get_input_buffer(void * handle , unsigned int * p_addr);
void cxon2_encode_write_stream_to_driver(void * handle , const void * strmbuf, unsigned int size, 
								  unsigned int keyframe);
void cxon2_encode_write_stream_head_to_driver(void * handle , const void * strmbuf, unsigned int size);
void cxon2_encode_image_ptr(void * handle , const void * data);
unsigned int cxon2_encode_get_phy_addr(void * handle , const void * ptr);

#ifdef __cplusplus
}
#endif

#endif


